import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

Map<String, dynamic> StatusList = {
  'empty': {'icon': 'assets/images/status/empty.png', 'text': 'Empty data'},
  'load-error': {
    'icon': 'assets/images/status/loading-error.png',
    'text': 'Loading error'
  },
  'nofound': {
    'icon': 'assets/images/status/nofound.png',
    'text': 'Results not found'
  },
  // 添加更多的键值对
};

class PageEmptyCom extends StatelessWidget {
  String? type;
  String icon;
  String title;
  double paddingTop;
  PageEmptyCom(
      {super.key,
      this.type = '',
      this.icon = 'assets/images/status/nofound.png',
      this.title = 'Results not found',
      this.paddingTop = 0});

  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return Container(
      padding: EdgeInsets.only(top: paddingTop),
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.center,
        mainAxisAlignment: paddingTop == 0
            ? MainAxisAlignment.center
            : MainAxisAlignment.start,
        children: [
          Image.asset(
            type != '' ? StatusList[type]['icon'] : icon,
            width: 140.w,
            height: 140.w,
          ),
          SizedBox(
            height: 15.w,
          ),
          Text(
            type != '' ? StatusList[type]['text'] : title,
            style: TextStyle(
              color: Color.fromRGBO(134, 131, 145, 1),
              fontSize: 14.sp,
              fontWeight: FontWeight.w400,
            ),
          )
        ],
      ),
    );
  }
}
